import 'package:chat_app_project/models/res_entity.dart';
import 'package:chat_app_project/tool/request_client.dart';

const FOLLOW = "/app/followers/follow/{followerId}";
const FOLLOW_LIST = "/app/followers/follows/list";
const UNFOLLOW = "/app/followers/unfollow/{followerId}";
const FAN_LIST = "/app/followers/fans/list";

class FollowDao {
  //关注
  static Future<ResEntity> follow(String followerId) async {
    var req = RequestClient();
    final response = await req.post(FOLLOW.replaceAll("{followerId}", followerId));
    return ResEntity.fromJson(response.data);
  }
  //关注列表
  static Future<ResEntity> followList(Map<String, dynamic> params) async {
    var req = RequestClient();
    final response = await req.get(FOLLOW_LIST, queryParameters: params);
    return ResEntity.fromJson(response.data);
  }
  //粉丝列表
  static Future<ResEntity> fanList(Map<String, dynamic> params) async {
    var req = RequestClient();
    final response = await req.get(FAN_LIST, queryParameters: params);
    return ResEntity.fromJson(response.data);
  }
  //取消关注
  static Future<ResEntity> unfollow(String followerId) async {
    var req = RequestClient();
    final response = await req.post(UNFOLLOW.replaceAll("{followerId}", followerId));
    return ResEntity.fromJson(response.data);
  }
}
